def radix_sort(li):
    max_num=max(li)
    it=0
    while 10**it<=max_num:
        buckets=[[] for _ in range(10)]
        for var in li:
            #987 it=1 987//10->98 98%10=8;
            digit=(var//10**it)%10
            buckets[digit].append(var)
        #分桶完成
        li.clear()
        #把数重新写回li
        for buc in buckets:
            li.extend(buc)
        it+=1

import random
li=list(range(1000))
random.shuffle(li)
radix_sort(li)
print(li)